package com.bookshop.service;

import com.bookshop.dao.IBookDao;
import com.bookshop.model.BookModel;
import com.bookshop.vo.BooksVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("bookservice")
public class BookService {
    @Resource(name="ibookdao")
    private IBookDao dao;
    public List<BooksVo> findAllBook(){
        return dao .findAllBook();
    }
    public List<BooksVo> findAllBooksById(int catalogId){
        return dao.findAllBooksById(catalogId);
    }
    public List<BooksVo> findAllBooksByName(String value){
        return dao.findAllBooksByName(value);
    }

    public void add(BookModel book) {
        dao.addBook(book);
    }

    public BookModel findBookById(String bookId) {
        return dao.findBookById(bookId);
    }

    public void updateBook(BookModel book) {
        dao.updateBook(book);
    }

    public void deleteBookById(String bookId) {
        dao.deleteBookById(bookId);
    }
}
